

//住院护士工作站
<template>
  <el-row style="min-height: calc(100vh - 150px); background: #e5e5e5">
    <el-col :span="24">
      <TopManu
        @handleNurse="handleNurse"
        @handlechuang="handlechuang"
        @handdepositset="handdepositset"

      />
    </el-col>
    <el-col :span="24" class="container">
      <el-col :span="span1" class="left-Content" style="background: #ffffff">
        <ViewTitle text="患者列表" />
        <el-col :span="24">
          <el-col :span="24">
            <div>
              <el-input
                placeholder="请输入内容"
                v-model="keyValue"
                @input="search"
                class="input-with-select"
              >
                           <el-button type="success"
                slot="append"

                @click="shouqi"
              >
                {{this.span1==5?'收起':'展开'}}
              </el-button>
              </el-input>
            </div>
          </el-col>
          <el-col :span="24">
            <el-radio-group
              v-model="is_new_advice"
              @change="search"
              size="small"
            >
              <el-radio label=""> 全部 </el-radio>
              <el-radio label="1"> 新医嘱 </el-radio>
            </el-radio-group>
          </el-col>
           <el-col :span="24">
    <el-radio-group
              v-model="order_by"
             @change="radiochang"
              size="small"
            >
              <el-radio label="1"> 床位正序 </el-radio>
              <el-radio label="2"> 床位倒序 </el-radio>
              <el-radio label="3"> 入院时间正序 </el-radio>
              <el-radio label="4"> 入院时间倒序 </el-radio>

            </el-radio-group>
          </el-col>

          <el-col :span="24">
            <el-col :span="7">
              <div style="margin-top: 15px">
                <span>病区</span>
                <el-select
                  v-model="selectValue"
                  @change="search"
                  placeholder="请选择"
                >
                  <el-option

                    @change="radiochang"
                    label="全部"
                    value=""
                  ></el-option>
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    @change="radiochang"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </div>
            </el-col>
            <el-col :span="7" :offset="1">
              <div style="margin-top: 15px">
                <span>类型</span>
                <el-select
                  v-model="rightRadio"
                  @change="radiochang"
                  multiple
                  placeholder="类型"
                >
                  <el-option
                    v-for="item in Radiooptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </div>
            </el-col>
            <el-col :span="7" :offset="1">
              <div style="margin-top: 15px">
                <span>执行情况</span>
                <el-select
                  v-model="advice_status"
                  @change="radiochang"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in radioValueForm1"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </div>
            </el-col>
          </el-col>
          <el-col :span="24" style="margintop: 10px">
            <FromList
              @handleCurrentChange="handleCurrentChange"
              :activityInfo="activityInfo"
              :tableData="tableData"
              :tableTitle="tbaleTitle"
              :activityFlag2="true"
              :height="470"
            />
          </el-col>
          <el-col :span="24" style="margintop: auto">
            <el-pagination
              background
              :current-page="page"
              :page-size="limit2"
              layout="total , prev, pager, next , jumper"
              @current-change="handlePagination"
              :total="userCount"
            ></el-pagination>
          </el-col>
        </el-col>
      </el-col>
      <el-col style="min-height: calc(100vh - 150px); width: 10px"> </el-col>
      <el-col :span="span2" class="right-Content">
        <infocrad v-if="span1==5" :id="user.id"></infocrad>
        <infocrad2 v-if="span1!=5" :id="user.id"></infocrad2>
        <div class="right-tabs">
          <div
            @click="
              () => {
                (activity = item.value),
                  (rightPage = 1),
                  (userCountOne = 0),
                  (activityInfoRight = 0);
              }
            "
            :class="activity == item.value ? 'activity' : ''"
            v-for="(item,index) in tabs"
            :key="item.value"
          >
            {{ item.name }}
            <div class="right_h" v-if="index==0">{{user.advice_djd}}</div>
            <div class="right_h" v-if="index==1">{{user.advice_dtz}}</div>

            <!-- <div class="right_h" v-if="index==2">{{user.advice_dzx}}</div> -->
          </div>
          <div
            style="marginLeft:auto;"
            @mousemove="showColor = true"
            @mouseleave="showColor = false"
          >
            说明
            <ul class="right-tabs-flex" v-if="showColor">
              <li>草稿</li>
              <li>提交</li>
              <li>校对</li>
              <li>完成</li>
              <li>待停止</li>
              <li>已停止</li>
              <li>废除</li>
              <li>已抄送</li>
            </ul>
          </div>
        </div>
        <div  v-if="activity != 5">
          <el-col :span="4" v-if="activity != 6">
            <el-radio-group
              v-model="rightKeyValueSelect"
              @change="searchRight"
              placeholder="请选择期效"
            >
              <el-radio-button size="small" label="1">长期</el-radio-button>
              <el-radio-button size="small" label="2">临时</el-radio-button>
            </el-radio-group>
          </el-col>
            <el-col
            :span="2"
            :offset="1"

            v-if="activity == 4"
          >
            <el-button @click="printAdvice">打印医嘱单</el-button>
          </el-col>
          <el-col :span="5" v-if="activity == 3">
            <el-date-picker
              v-model="execution_time2"
              type="date"
              @change="searchRight"

              placeholder="日期查询"

              value-format="yyyy-MM-dd"
            >
            </el-date-picker>
          </el-col>
          <el-col :span="4" v-if="activity != 6">
            <el-input
              placeholder="请输入内容"
              v-model="rightKeyValue"
               @change="searchRight"
            ></el-input>
          </el-col>

          <el-col
            :span="5"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 3"
          >
            <el-select v-model="advice_statusOne" @change="searchRight" placeholder="请选择">
              <el-option
                v-for="item in radioValueForm"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-col>
          <el-col
            :span="2"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 3"
          >
            <el-button @click="handlePerformFlag">一键执行</el-button>
          </el-col>

             <el-col
            :span="2"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 2"
          >
           <el-select v-model="statusvalue" placeholder="" @change="searchRight">
             <el-option

      label="全部"
      value="">
    </el-option>
    <el-option

      label="已校对"
      value="3">
    </el-option>
      <el-option

      label="待停止"
      value="5">
    </el-option>
  </el-select>
          </el-col>
              <el-col
            :span="2"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 2"
          >

                 <el-select v-model="statusvalue2" placeholder=""  @change="adviceGetAdviceList">
             <el-option

      label="医嘱单"
      value="3,5">
    </el-option>
    <el-option

      label="全部"
      value="3,4,5,6">
    </el-option>

  </el-select>
          </el-col>

          <el-col
            :span="2"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 2"
          >
            <el-button @click="binglilogdeposit3=true,send_time=newDate()">一键抄送药房</el-button>
          </el-col>
           <el-col
            :span="2"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 2"
          >
            <el-button @click="ifexex">一键生成执行单</el-button>
          </el-col>
             <el-col
            :span="2"
            :offset="1"
            style="display: flex; align-self: center"
            v-if="activity == 2"
          >
            <el-button @click="tingzhilogdeposit=true,stop_time=newDate()">一键停止</el-button>
          </el-col>
          <!-- <el-col
            :span="2"
            v-if="activity != 6"
            :offset="1"
            style="display: flex; align-self: center"
          >
            <el-button @click="searchRight">查询</el-button>
          </el-col>
          <el-col
            :span="2"
            v-if="activity != 6"
            style="display: flex; align-self: center"
          >
            <el-button @click="resetRight">重置</el-button>
          </el-col> -->
        </div>
        <div class="right-from" v-if="activity == 1">
          <FromList
            @handleCurrentChange="handleCurrentChangeSchool"
            @handleEdit="handleEdit"
            :activityInfo="activityInfoRight"
            :tableData="schoolData"
            :tableTitle="schoolTitle"
            :activityFlag="true"
             :highlightCurrentRow="true"
            :height="height"
          />
        </div>
        <div class="right-from" v-if="activity == 2">
          <FromList
            @handleCurrentChange="handleCurrentChangeSchool"
            @handleCommand="handleCommand"
            :activityInfo="activityInfoRight"
            :highlightCurrentRow="true"
            :tableData="adviceData"
            :height="height"
            :tableTitle="adviceTitle"
            :typeCheckbox="true"
            :activityFlag="true"
            @handelChange="handelChangeMask"
          />
        </div>
        <div class="right-from" v-if="activity == 3">
          <FromList
           :highlightCurrentRow="true"
            @handleCurrentChange="handleCurrentChangeSchool"
            :activityInfo="activityInfoRight"
            @handleEdit="handleEditCarry"
            :tableData="deductionData"
            :selectHan="1"
            :tableTitle="deductionTitle"
            @handelChange="handelChange"
            :typeCheckbox="true"
            :performFlag="true"
            :height="height"
          />
        </div>
        <div class="right-from" v-if="activity == 4">
          <FromList
           :highlightCurrentRow="true"
            @handleCurrentChange="handleCurrentChangeSchool"
            :activityInfo="activityInfoRight"
            @handleEdit="handleEdit"
            :tableData="allData"
            :tableTitle="allTitle"
             @handelChange="handelChange2"
            :typeCheckbox="true"
            :activityFlag="true"
            :height="height"
          />
        </div>
        <div class="right-from" v-if="activity == 5">
          <el-row :gutter="12">
            <el-col :span="12" v-for="(item, index) in binglilist" :key="index">
              <el-card shadow="always">
                <el-row>
                  <el-col :span="6">
                    <img src="@/assets/bingli.png" alt width="100px" />
                  </el-col>
                  <el-col :span="14">
                    <h3>{{ item.tpl_name }}</h3>
                    <span>更新时间:{{ item.save_time }}</span>
                  </el-col>
                  <el-col :span="4">
                    <el-button
                      style="float: right"
                      type="success"
                      @click="hedachakan(item)"
                      >查看</el-button
                    >
                  </el-col>
                </el-row>
              </el-card>
            </el-col>
          </el-row>
        </div>
        <div class="right-from" v-if="activity == 6">
          <inputList
            :flag="true"
            :tableTitle="twTitle"
            @handleTwClick="handleTwClick"
            ref="inputList2"
            :tableData="twData"
            :type="2"
          />
        </div>
        <el-col
          :span="24"
          class="flexPagination"
          style="margintop: auto; display: flex"
        >
          <el-pagination
            background
            :current-page="rightPage"
            :page-size="limit"
            layout="total , prev, pager, next , jumper"
            @current-change="rightHandlePagination"
            :total="userCountOne"
          ></el-pagination>
        </el-col>

      </el-col>
    </el-col>
    <!-- 护理 -->
    <el-dialog
      title="护理"
      :visible.sync="nurseVisible"
      width="70%"
      :close-on-click-modal="false"
      :before-close="handleClose"
    >
      <span style="display: block">
        <viewTitle text="基本信息" style="font-size: 20px" />
        <div class="separate" style="margintop: 20px">
          <infocrad :id="user.id"></infocrad>
        </div>
        <viewTitle
          text="护理信息"
          style="font-size: 20px; margin-bottom: 20px"
        />
        <el-form ref="form" :model="nurseFrom" label-width="auto">
          <el-col :span="24" class="flexBoom">
            <el-col :span="12">
              <el-form-item label="原护理等级">
                <el-select
                  v-model="user.nurse_level"
                  disabled
                  placeholder="请选择原护理等级"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="新护理等级">
                <el-select
                  v-model="nurseFrom.pid"
                  placeholder="请选择新护理等级"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-form-item label="变更摘要">
              <el-input type="textarea" v-model="nurseFrom.reamrk"></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="nurseVisible = false">取 消</el-button>
        <el-button type="primary" @click="nurseConfirm">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 转科 -->
    <el-dialog
      title="转科"
      :visible.sync="changeVisible"
      width="70%"
      :before-close="handleClose"
    >
      <span style="display: block">
        <viewTitle text="基本信息" style="font-size: 20px" />
        <div class="separate" style="margintop: 20px">
          <infocrad :id="user.id"></infocrad>
        </div>
        <viewTitle
          text="房间床位信息"
          style="font-size: 20px; margin-bottom: 20px"
        />
        <el-form ref="form" :model="changeData" label-width="auto">
          <el-col :span="24" class="flexBoom">
            <el-col :span="12">
              <el-form-item label="原病区">
                <el-select
                  v-model="changeData.nurse_level"
                  disabled
                  placeholder="请选择原护理等级"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="新病区">
                <el-select
                  v-model="changeData.pid"
                  placeholder="请选择新护理等级"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="24" class="flexBoom">
            <el-col :span="12">
              <el-form-item label="原科室">
                <el-select
                  v-model="changeData.nurse_level"
                  disabled
                  placeholder="请选择原科室"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="新科室">
                <el-select v-model="changeData.pid" placeholder="请选择新科室">
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="24" class="flexBoom">
            <el-col :span="12">
              <el-form-item label="原经治医生">
                <el-select
                  v-model="changeData.nurse_level"
                  disabled
                  placeholder="请选择原经治医生"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="新经治医生">
                <el-select
                  v-model="changeData.pid"
                  placeholder="请选择新经治医生"
                >
                  <el-option
                    v-for="item in levelNature"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-form-item label="变更摘要">
              <el-input type="textarea" v-model="nurseFrom.reamrk"></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="changeVisible = false">取 消</el-button>
        <el-button type="primary" @click="changeVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 护理单 -->
    <el-dialog
      title="护理单"
      :visible.sync="nurseOneVisible"
      width="80%"
      :before-close="handleClose"
    >
      <span class="scrrolXFlex" style="display: block">
        <viewTitle text="基本信息" style="font-size: 20px" />
        <div class="separate" style="margin: 20px 0">
          <e-desc :data="user" margin="0 12px" column="3" labelWidth="100px">
            <e-desc-item label="姓名">{{ user.memberName }}</e-desc-item>
            <e-desc-item label="性别">{{ user.memberGender }}</e-desc-item>
            <e-desc-item label="年龄">{{ user.memberAge }}岁</e-desc-item>
            <e-desc-item label="床位">{{ user.bedName }}</e-desc-item>
          </e-desc>
        </div>
        <viewTitle
          text="护理信息"
          style="font-size: 20px; margin-bottom: 20px"
        />

        <inputList
          :tableTitle="hlTitle"
          ref="inputList1"
          :tableData="hlData"
          :type="1"
        />
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button
          @click="
            () => {
              (hlData = []), (nurseOneVisible = false);
            }
          "
          >取 消</el-button
        >
        <el-button type="primary" @click="handleClickNurse">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 计价 -->
    <el-dialog
      title="计价单"
      :visible.sync="valuationEditFlag"
      v-if="valuationEditFlag"
      width="80%"
      top="10vh"
      :before-close="handleClose"
    >
      <span style="display: block" class="span">
       <span style="font-size:16px"> 计价时间:</span> <input type="datetime-local" step="01"  v-model="deduction_time" />
        <EditFrom
          ref="EditFrom"
          :type="valuationEditType"
          :advice_id="advice_id"
          :flag="false"
          :tableTitle="valuationEditTitle"
          :tableData="valuationEditData"
        />
      </span>
           <div class="right-from" style="margintop: auto">
          <viewTitle text="计价记录" />
          <FromList
            style="margintop: 10px"
            :tableData="valuationData"
            :tableTitle="valuationTitle"
          />
        </div>
      <span slot="footer" class="dialog-footer">
        <el-button
          @click="(valuationEditFlag = false), (valuationEditData = [])"
          >取 消</el-button
        >
        <el-button type="primary" @click="valuationEditFunction"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 体温 -->
    <el-dialog
      title="体温单"
      :visible.sync="animalFlag"
      width="80%"
      :before-close="handleClose"
    >
      <span style="display: block">
        <viewTitle text="基本信息" style="font-size: 20px" />
        <div class="separate" style="margin: 20px 0">
          <e-desc :data="user" margin="0 12px" column="3" labelWidth="100px">
            <e-desc-item label="姓名">{{ user.memberName }}</e-desc-item>
            <e-desc-item label="性别">{{ user.memberGender }}</e-desc-item>
            <e-desc-item label="年龄">{{ user.memberAge }}岁</e-desc-item>
            <e-desc-item label="床位">{{ user.bedName }}</e-desc-item>
          </e-desc>
        </div>
        <viewTitle
          text="体温信息"
          style="font-size: 20px; margin-bottom: 20px"
        />
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="animalFlag = false">取 消</el-button>
        <el-button type="primary" @click="handleTwClick">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 催缴打印 -->
    <el-dialog
      title="催缴打印"
      :visible.sync="paymentFlag"
      width="85%"
      :before-close="handleClose"
    >
      <span style="display: block">
        <iframeDemo :url="url" ref="iframeDemo" height="500px" />
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="paymentFlag = false">取 消</el-button>
        <el-button type="primary" @click="paymentFlag = false">确 定</el-button>
      </span>
    </el-dialog>
         <el-dialog
        :fullscreen="true"
        :close-on-click-modal="false"
        :visible.sync="iframeFlag"
        :before-close="offiframe"

      >
      <span style="display: block">
         <iframeDemo :url="orurl" ref="iframeDemo" height="800px" />
      </span>
    </el-dialog>
    <!-- <Splitbed /> -->
    <!-- 分床弹框 -->
    <el-dialog
      :fullscreen="true"
      :close-on-click-modal="false"
      title="分床"
      :visible.sync="dialogFormVisible1"
    >
        <infocrad :id="user.id"></infocrad>
      <Splitbed
        ref="splitbed"
        :patientinfo="user"
        @splitbed="splitbed(arguments)"
      />
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible1 = false">取 消</el-button>
        <el-button type="primary" @click="handelMemberSave">保 存</el-button>
      </div>
    </el-dialog>
      <!-- 退费 -->

    <el-dialog
      :fullscreen="true"
      :close-on-click-modal="false"
      title="退费"
      :visible.sync="tuifeiguanli"
    >
     <infocrad :id="user.id"></infocrad>
        <costtuifei :id="user.id" :uid="user.member && user.member.id"></costtuifei>

      <div slot="footer" class="dialog-footer">
        <el-button @click="tuifeiguanli = false">取 消</el-button>

      </div>
    </el-dialog>
    <!-- 皮试 -->
    <el-dialog
      :close-on-click-modal="false"
      title="皮试结果录入"
      :visible.sync="sktext"
      width="70%"
      top="10vh"
    >
      <span>
        <ViewTitle text="基础信息" />
        <div class="separate" style="margin: 20px 0">
          <e-desc :data="user" margin="0 12px" column="3" labelWidth="100px">
            <e-desc-item label="姓名">{{ user.memberName }}</e-desc-item>
            <e-desc-item label="性别">{{ user.memberGender }}</e-desc-item>
            <e-desc-item label="年龄">{{ user.memberAge }}岁</e-desc-item>
            <e-desc-item label="床位">{{ user.bedName }}</e-desc-item>
          </e-desc>
        </div>
        <ViewTitle text="皮试信息" />
        <el-form
          label-width="80px"
          :model="skAddObject"
          style="margintop: 20px"
        >
          <el-col :span="7">
            <el-form-item label="药品名称">
              <el-input
                v-model="skAddObject.name"
                disabled
                placeholder="药品名称"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="7">
            <el-form-item label="药品规格">
              <el-input
                v-model="skAddObject.specification"
                disabled
                placeholder="药品规格"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="7">
            <el-form-item label="皮试批号">
              <el-input
                v-model="skAddObject.regio"
                placeholder="皮试批号"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="皮试结果">
              <el-radio-group v-model="skAddObject.number">
                <el-radio label="1">阴性</el-radio>
                <el-radio label="2">阳性</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="皮试说明">
              <el-input
                type="textarea"
                show-word-limit
                style="width: 100%"
                v-model="skAddObject.textTrea"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-form>
        <el-form
          label-width="80px"
          :model="skAddObject"
          class="demo-form-inline"
        >
          <el-col :span="10">
            <el-form-item label="开始时间">
              <el-date-picker
                type="datetime"
                placeholder="选择日期"
                v-model="skAddObject.newTime"
                format="yyyy-MM-dd HH:mm:ss"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="结束时间">
              <el-date-picker
                type="datetime"
                placeholder="选择日期"
                v-model="skAddObject.endTime"
                format="yyyy-MM-dd HH:mm:ss"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-form>
        <ViewTitle text="历史记录" />
        <FromList :tableData="skData" :tableTitle="skTitle" />
      </span>
      <div slot="footer" class="dialog-footer">
        <el-button @click="sktext = false">取 消</el-button>
        <el-button type="primary" @click="skinTest">保 存</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      center
      title="确认时间"
      :visible.sync="binglilogdeposit"
      width="40%"
    >
      <el-col :span="12">
        <div class="block">

          <input type="datetime-local" step="01"  v-model="execution_time" />
        </div>
      </el-col>
       <el-col :span="12">
        <h3 class="block">

        当前操作员：{{real_name}} 执行金额：{{zhixingmoney}}
        </h3>
      </el-col>
      <div slot="footer" class="dialog-footer" style="margintop: 30px">
        <el-button @click="binglilogdeposit = false">取 消</el-button>
        <el-button type="success" @click="saveXml">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      center
      title="确认时间"
      :visible.sync="binglilogdeposit3"
      width="30%"
    >
      <el-col :span="24">
        <el-col :span="12">
        <div class="block">

          <input type="datetime-local" step="01"  v-model="send_time" />
        </div>
          </el-col>
        <el-col :span="12">
        <h3 class="block">

        当前操作员：{{real_name}}
        </h3>
      </el-col>
      </el-col>
      <div slot="footer" class="dialog-footer" style="margintop: 30px">
        <el-button @click="binglilogdeposit3 = false">取 消</el-button>
        <el-button type="success" @click="addMask">确 定</el-button>
      </div>
    </el-dialog>
       <el-dialog
      :close-on-click-modal="false"
      center
      title="确认时间"
      :visible.sync="tingzhilogdeposit"
      width="30%"
    >
      <el-col :span="12">
        <div class="block">

          <input type="datetime-local" step="01" v-model="stop_time" />
        </div>

      </el-col>
        <el-col :span="12">
        <h3 class="block">

        当前操作员：{{real_name}}
        </h3>
      </el-col>
      <div slot="footer" class="dialog-footer" style="margintop: 30px">
        <el-button @click="tingzhilogdeposit = false">取 消</el-button>
        <el-button type="success" @click="adviceNurseStopAdvice">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="一键执行"
      :visible.sync="performFlag"
      width="40%"
      :before-close="handleClosePerform"
    >
      <span>


         <el-col :span="12">
        <div class="block">

          <input type="datetime-local" step="01"  v-model="performDate" />
        </div>
      </el-col>
       <el-col :span="12">
        <h3 class="block">

       当前操作员：{{real_name}}  执行金额：{{zhixingmoney}}
        </h3>
      </el-col>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="performFlag = false">取 消</el-button>
        <el-button type="primary" @click="addExecute">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      title="提示"
      center
      :visible.sync="chuyuantilogdeposit"
      width="30%"
    >
      <el-col :span="24">
        <h3 style="padding: 0px; margin: 5px">提交出院后产生以下后果:</h3>
      </el-col>
      <el-col :span="24" style="padding: 0px; margin: 5px">
        1、患者状态由医嘱出院变为待出院
      </el-col>
      <el-col :span="24" style="padding: 0px; margin: 5px">
        2、房间床位将释放
      </el-col>
      <el-col :span="24" style="padding: 0px; margin: 5px">
        是否将患者【{{ user.memberName }} {{ user.memberGender }}】（住院号：{{
          user.ipt_no
        }}）提交出院？
      </el-col>
      <el-col :span="24" style="padding: 0px; margin: 5px">
        <!-- <el-date-picker
          v-model="apply_time"
          type="date"
          placeholder="出院时间"
          format="yyyy 年 MM 月 dd 日"
          value-format="yyyy-MM-dd"
        >
        </el-date-picker> -->
         <input type="datetime-local"  step="01" v-model="apply_time" />
      </el-col>
      <div
        slot="footer"
        class="dialog-footer"
        style="padding: 0px; margin: 5px"
      >
        <el-button @click="chuyuantilogdeposit = false">取 消</el-button>
        <el-button type="success" @click="tijiaochuyuan">确定</el-button>
      </div>
    </el-dialog>

    <!-- 床头卡 -->
    <el-dialog
      :fullscreen="true"
      :close-on-click-modal="false"
      title="床头卡"
      center
      :visible.sync="chuangtoudeposit"
      width="30%"
    >
      <el-col :span="24">
        <PatientList  />
      </el-col>
      <div
        slot="footer"
        class="dialog-footer"
        style="padding: 0px; margin: 5px"
      >
        <el-button @click="chuangtoudeposit = false">取 消</el-button>
        <el-button type="success" @click="chuangtoudeposit = false"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <!-- 费用清单注释 -->
       <!-- <el-dialog
      :fullscreen="true"
      :close-on-click-modal="false"
      title="费用"
      :visible.sync="dialogFormVisible12"
    >
  <costRecord ref="mychild" :id='user.id'>
  </costRecord>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible12 = false">取 消</el-button>

      </div>
    </el-dialog> -->
     <el-dialog
     v-if="dialogFormVisible12"
      :fullscreen="true"
      :close-on-click-modal="false"
      title="每日费用清单"
      :visible.sync="dialogFormVisible12"
    >
              <feeList ref="mychild" :id='user.id'> </feeList>

    </el-dialog>
    <el-dialog
      :fullscreen="true"
      :close-on-click-modal="false"
      title="打印医嘱单"
      :visible.sync="yizhudataVisible1"
    >
  <yizhudan @reload='reload' v-if='rightKeyValueSelect=="1"' :yizhudata='yizhudata' :type='rightKeyValueSelect'/>
  <linyizhudan @reload='reload' v-else-if="rightKeyValueSelect=='2'" :yizhudata='yizhudata' :type='rightKeyValueSelect'/>
      <div slot="footer" class="dialog-footer">
        <el-button @click="yizhudataVisible1 = false">取 消</el-button>

      </div>
    </el-dialog>
        <el-dialog
      title="生成执行单"
      :visible.sync="ifexecution_time"
      width="30%"
      :before-close="handleClosePerform"
    >
      <span>
        <!-- <el-date-picker
          v-model="zhixupdata.execution_time"
          type="datetime"
          format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="选择日期时间"
        >
        </el-date-picker> -->
        <el-col :span="12">
           <input type="datetime-local"  step="01" v-model="zhixupdata.execution_time" />
       </el-col>
      <el-col :span="12">
        <h3 class="block">

        当前操作员：{{real_name}}
        </h3>
      </el-col>
      </span>
      <input type="text" placeholder="补录原因" v-model="zhixupdata.remark">
      <span slot="footer" class="dialog-footer">
        <el-button @click="ifexecution_time = false">取 消</el-button>
        <el-button type="primary" @click="addExecute2">确 定</el-button>
      </span>
    </el-dialog>
  </el-row>
</template>

<script>
let that;
import FromList from "@/forComponents/fromList/fromList2";
import FromListButton from "@/forComponents/fromListButton/fromList";
import TopManu from "@/components/TopMenu";
import EditFrom from "@/components/EditFrom";
import ViewTitle from "@/forComponents/viewTitle";
import EDesc from "@/components/desc/desc.vue";
import EDescItem from "@/components/desc/descItem.vue";
import inputList from "./components/inputList.vue";
import { iframeUrl,iframeDeptName ,http2} from "@/utils/server.js";
import iframeDemo from "@/components/iframeDemo/index.vue";
import { newDate } from "@/utils/newDate.js";
import Splitbed from "./components/Splitbed.vue";
import infocrad from "./components/infocrad.vue";
import infocrad2 from "./components/infocrad2.vue";
import costtuifei from "./components/costtuifei.vue";
import PatientList from "../hospital/components/patientList.vue";
import {
  tableTitle,
  schoolTitle,
  valuationTitle,
  adviceTitle,
  deductionTitle,
  allTitle,
  valuationEditTitle,
  temperatureTitle,
  nurseTitle,
  hlTitle,
  twTitle,
  skTitle,
} from "./tableTitle.js";
import { newDateY } from "@/utils/newDate.js";
// import iframeDemo from "@/components/iframeDemo/index.vue"
import yizhudan from "./components/yizhudan.vue";
import linyizhudan from "./components/linyizhudan.vue";
import costRecord from "./components/costRecord.vue";
import feeList from "./components/feeList.vue";
import {
  getHospitalMember,
  getAllIcu,
  dict_dataDictIndex,
  adviceGetExecutionList,
  adviceGetAdviceList,
  getNurseAdvice,
  getNurseLevel,
  setNurseLevel,
  proofreaderAdvice,
  adviceNurseStopAdvice,
  createNurseAdvice,
  getGenPharmacyDrug,
  getNurseSheet, //护理单列表
  updateNurseSheet,
  getTemperature,
  updateTemperature,
  addExecutionRecord,
  getDictIndex,
  getSkinTest,
  deductionAdvice,
  skinTest,
  refundDrug,
  cancelPharmacyDrug,
  batchExectutionAdvice,
  getNurseAutoProject
} from "@/api/hospitalNurse";
import {
 cancelSubmitHospital,
  distributeBed,
  getMemberMedicalList,
  submitHospital,
  printAdvice
} from "@/api/zhuyanre.js";
import { parse } from 'path-to-regexp';
export default {
  name:"hospitalNurse",
  data() {
    //status(1=草稿2提交3校对4完成5待停止6已停止7废除)'
    return {
      url: `${iframeUrl}/#/info?type=2`,
      valuationEditType: 1, //计价值
      dialogFormVisible1: false,
      paymentFlag: false, //催缴FLag
      keyValue: "", //搜索框值
      valuationEditTitle: valuationEditTitle, //计价编辑表单title
      temperatureTitle: temperatureTitle, //体温单
      nurseTitle: nurseTitle, //护理单
      showColor: false,
      valuationEditFlag: false,
      user_id:'',
      options: [],
      activity: 1,
      activityInfo: 0,
      hlTitle: hlTitle, //护理单组件需要
      hlData: [], //护理单组件数据
      twTitle: twTitle, //体温单Title
      twData: [], //体温单数据
      activityInfoRight: 0,
      rightRadio: ["2"],
      binglilogdeposit: false,
      execution_time: "",
      binglilist: [],
      statusvalue2:'3,5',
      edataid:[],
      deduction_time:'',
      chuyuantilogdeposit: false,
      chuangtoudeposit: false,
      dialogFormVisible12:false,
      apply_time: "",
      execution_time2: "",
      orurl:'',
      iframeFlag:false,
      tingzhilogdeposit:false,
      tuifeiguanli:false,
      stop_time:'',
      Radiooptions: [
        {
          value: "1",
          label: "待入院",
        },
        {
          value: "2",
          label: "在院",
        },
        {
          value: "3",
          label: "申请出院",
        },
        {
          value: "4",
          label: "待出院",
        },
        {
          value: "5",
          label: "已出院",
        },
      ],
      tabs: [
        {
          name: "待校对",
          value: 1,
        },
        {
          name: "医嘱单",
          value: 2,
        },
        {
          name: "执行单",
          value: 3,
        },
        {
          name: "病历",
          value: 5,
        },
        {
          name: "体温单",
          value: 6,
        },
        {
          name: "全部",
          value: 4,
        },
      ],
      statusvalue:'',
      tbaleTitle: tableTitle, //病区病人列表
      schoolTitle: schoolTitle, //待校对
      schoolData: [], //待校对数据
      tableData: [],
      valuationTitle: valuationTitle, //计价记录
      valuationData: [], //计价data
      valuationEditData: [],
      selectValue: "", //select接受值
      page: 1,
      limit: 100,
      limit2: 20,
      userCount: 0,
      zhixingmoney:0,
      dataNature: [], //数据字典
      rightKeyValue: "",
      adviceTitle: adviceTitle, //医嘱记录
      adviceData: [], //医嘱数据
      deductionTitle: deductionTitle, //待执行
      deductionData: [], //待执行数据
      allTitle: allTitle, //全部
      allData: [], //全部数据
      separateDiading: false,
      yizhudataVisible1:false,
      yizhudata:{},
      entry: false, //第一次进入
      user: {},
      status: 2,
      radioValue: "",
      nurseVisible: false,
      changeVisible: false,
      is_new_advice: "",
       order_by:'1',
      nurseFrom: {
        //护理等级弹窗
        pid: "",
        name: "",
        reamrk: "",
      },
      levelNature: {},
      changeData: {},
      nurseOneVisible: false, //护理单显隐
      doctorsData: {}, //医嘱数据
      valuationValue: "",
      advice_id: "",
      animalFlag: false,
      timeSelect: [
        {
          label: "全部",
          value: 0,
        },
        {
          label: "长期",
          value: 1,
        },
        {
          label: "临时",
          value: 2,
        },
      ],
      rightKeyValueSelect: "1",
      rightPage: 1,
      userCountOne: 0,
      speedData: [],
      sktext: false,
      tuiyaodeposit: false,
      skData: [],
      skTitle: skTitle,
      skAddObject: {
        name: "",
        regio: "",
        specification: "",
        number: "1",
        textTrea: "",
        newTime: "",
        endTime: "",
        advice_id: "",
        recipe_drug_id: "",
      },
        radioValueForm1: [
        {
          name: "全部",
          id: "",
        },
        {
          name: "临时已执行",
          id: 1,
        },
        {
          name: "临时未执行",
          id: 2,
        },
      ],
      radioValueForm: [
        {
          name: "全部",
          id: "",
        },
        {
          name: "已执行",
          id: 1,
        },
        {
          name: "未执行",
          id: 2,
        },
        {
          name: "已退费",
          id: 3,
        },
      ],
      advice_status: "",
      advice_statusOne: "",
      tid: "",
      performData: [],
      performData2: [],
      maskData2:[],
      performFlag: false,
      performDate: "",
      maskData: [],
      height: 0,
      zhixupdata:{
          hospital_id:'',
          id:'',
          execution_time:'',
          remark:''
      },
      ifexecution_time:false,
      addExecu:0,
      span1:5,
      span2:19,
      binglilogdeposit3:false,
      send_time:'',
      height2:0,
      height3:0,
      real_name:'',
    };
  },
  mounted() {
    that = this;
    this.getNurseLevel();
    this.dict_dataDictIndex();
    this.dict_dataDictIndexTw();
    this.getAllIcu();
    this.getHospitalMember();
    this.getDictIndex();
    this.getMemberMedicalList();
    this.height2=document.documentElement.clientHeight-350
     this.height3= this.height2+70
     this.real_name=JSON.parse(localStorage.getItem('userInfo')).real_name
    // console.log(parse(localStorage.getItem('userInfo')))
  },
  watch: {
    activity(to) {
      this.rightKeyValue = "";
      this.radioValue = "";
      that.height=100
      // this.rightKeyValueSelect = "";
      switch (to) {
        case 1:
          this.limit = 100;
          this.status = 2;
          this.adviceGetAdviceList();
          break;
        case 2:
          this.limit = 100;
          this.status = 3;

          this.adviceGetAdviceList();
          break;
        case 3:
           let date = new Date()
        let yyyy = date.getFullYear()
        let MM = (date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : (date.getMonth() + 1)
        let dd = date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()
    this.execution_time2=yyyy+'-'+MM+'-'+dd
          this.limit = 100;
          this.radioValue = "";
          this.adviceGetExecutionList();

          break;
        case 4:
          this.limit = 100;
          this.status = "";
          this.adviceGetAdviceList();
          break;
        case 5:
          this.getMemberMedicalList();
          break;
        case 6:
          this.getTemperature();
          break;
      }
    },
    user() {
      if (this.activity == 3) {
        this.adviceGetExecutionList();
      } else if (this.activity == 5) {
        this.getMemberMedicalList();
      } else {
        this.adviceGetAdviceList();
      }
      this.rightPage = 1;
      this.userCountOne = 0;
      // this.schoolData = [];
      // this.adviceData = [];
      // this.valuationData = [];
      // this.performData = [];
      // this.allData = [];
    },
  },
  methods: {
    tableRowClassName({ row, rowIndex }) {
      if (row.status === "草稿") {
        return "status-1";
      } else if (row.status === "提交") {
        return "status-2";
      } else if (row.status === "校对") {
        return "status-3";
      } else if (row.status === "完成") {
        return "status-4";
      } else if (row.status === "待停止") {
        return "status-5";
      } else if (row.status === "已停止") {
        return "status-6";
      } else if (row.status === "废除") {
        return "status-7";
      }
      return "";
    },
    handlechuang() {

      this.chuangtoudeposit = true;
    },
    handelChangeMask(e) {
      let data = [];
      e = e.filter((item) => {
        if (item.status != 2 && item.status != 6) {
          return item;
        }
      });
      e.forEach((item) => {
        data.push(item.id);
      });
      this.maskData = data;
      this.edataid = data
        //  console.log(this.edataid )
    },
        handelChange2(e) {
      let data = [];

      e.forEach((item) => {
        data.push(item.id);
      });
      this.maskData2 = data;
        //  console.log(this.edataid )
    },
    // 抄送
    addMask() {
      if (this.maskData.length != 0) {
        let data = this.maskData.join(",");
        // //  console.log(data,this.maskData)
        getGenPharmacyDrug({ advice_ids: data, hospital_id: this.user.id,send_time:this.send_time.replace('T',' ') })
          .then((res) => {
            if (res.code==200) {
                  this.$message({
              message: "抄送成功",
              type: "success",
            });
            }

            // this.adviceData = [];
            // this.getHospitalMember()
            this.binglilogdeposit3=false
            this.adviceGetAdviceList();
          })
          .catch((e) => {
            this.$message({
              message: e.message,
              type: "error",
            });
          });
      } else {
        this.$message({
          message: "请选择要抄送的医嘱",
          type: "error",
        });
      }
    },
    handelChange(e) {
      let data = [];
      e = e.filter((item) => {
        if (item.status != 1) {

          return item;
        }
      });


      e.forEach((item,index) => {
         item.num=0
        data.push(item.id);
      });
       //  console.log(e)
      if(e.length>1){
      for(let i=0;i<e.length;i++){
         //  console.log(i)
         if(i==0){
               e[0].num=this.NumberAdd(parseFloat(e[0].num), parseFloat(e[i].get_advice.total))


      }else if(i==e.length-1){
          this.zhixingmoney=that.NumberAdd(e[e.length-2].num, parseFloat(e[i].get_advice.total))
      }else{
         e[i].num=this.NumberAdd(e[i-1].num, parseFloat(e[i].get_advice.total))
      }
      }
}else{
        this.zhixingmoney=e[0].get_advice.total
}



      this.performData2 = data;

    },
    //获取病历
    getMemberMedicalList() {
      var that = this;
      // console.log('this.user.id:::', this.user.id, '  this.user.member.id::', this.user.member.id)
      getMemberMedicalList({ hospital_id: this.user.id }).then((res) => {
        that.binglilist = res.data;
      });
    },
      offiframe(){
       this.iframeFlag=false
        this.getMemberMedicalList()
    },
  hedachakan(item) {
    if(item.is_new==1){

      this.iframeFlag=true
      this.$nextTick(()=>{
          this.orurl=`${iframeUrl}/#/caselist2?templateId=${item.id}&id=${this.user.id}&token=${localStorage.getItem("token")}&member_id=${this.user.member && this.user.member.id}&userType=2&ifType=2&tpl_name=${item.tpl_name}&category_id=${item.tpl_id}`
          setTimeout(function () {
            that.$nextTick(function () {
              let json = {
                templateId:item.id,
                id:this.user.id,
                member_id:this.user.member && this.user.member.id,
                userType:2,
                ifType:2,
                tpl_name:item.tpl_name,
                category_id:item.tpl_id,
              };
              // member_id:this.user.userId,id:this.user.id,type:this.user.type
              this.$refs.iframeDemo.handleEmit(json);
            });
          }, 100);
      })

    }else{
       var http=`${http2}?tepid=${item.tpl_id}&is_pattern=2&uid=${this.user.id}&source=4&his_uid=${this.real_id}&real_name=${this.real_name}&tep_name=${item.tpl_name}&cid=${item.id}`

        window.open(http,'_blank');
    }
    },
    addExecute() {
      let data = this.performData2.join(",");

      if (data.length == ",") {
        this.$message({
          message: "请先选择要执行的医嘱或者请选择未执行的医嘱",
          type: "error",
        });
      } else {
        deductionAdvice({ ids: data, hospital_id: this.user.id,execution_time:this.performDate.replace('T',' ') })
          .then((res) => {
             if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
            this.zhixingmoney=0
            this.performFlag = false;
            this.adviceGetExecutionList();
          })
          .catch((e) => {
            this.$message({
              message: e.message,
              type: "error",
            });
          });
      }
    },
    addExecute2(){
        var data=this.zhixupdata
      data.execution_time=data.execution_time.replace('T',' ')
      data.hospital_id = this.user.id
      // //  console.log(this.addExecu)
      if(this.addExecu==1){
        delete data.id
          data.ids=this.maskData.join(",")
          batchExectutionAdvice(data).then(res=>{
              if(res.code==200){
                      this.$message({
              message: "操作成功",
              type: "success",
            });
            this.ifexecution_time=false
              }else{
                this.$message({
              message: res.message,

            });

              }
        }).catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          })
          })
      }else{
               addExecutionRecord(data).then(res=>{
              if(res.code==200){
                      this.$message({
              message: "操作成功",
              type: "success",
            });
            this.ifexecution_time=false
              }else{
                this.$message({
              message: res.message,

            });

              }
        }).catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          })
          })
      }


    },
    ifexex(){
        this.ifexecution_time=true
        this.addExecu=1
        this.zhixupdata.execution_time=this.newDate()

    },
    // 记录皮试结果
    skinTest(e) {
      let data = {
        start_time: this.skAddObject.newTime,
        end_time: this.skAddObject.endTime,
        fill_no: this.skAddObject.regio,
        description: this.skAddObject.textTrea,
        hospital_id: this.user.id,
        result: Number(this.skAddObject.number),
        advice_id: this.skAddObject.advice_id,
        recipe_drug_name: this.skAddObject.name,
        recipe_drug_id: this.skAddObject.recipe_drug_id,
      };
      skinTest({ ...data })
        .then((res) => {
          Object.keys(this.skAddObject).forEach((key) => {
            this.$set(this.skAddObject, key, "");
          });
          this.sktext = false;
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 获取皮试结果
    getSkinTest(e) {
      getSkinTest({ advice_id: e })
        .then((res) => {
          this.skData = res.data[0].lists;
          for (let i = 0; i < this.skData.length; i++) {
            this.skData[i].resultname =
              this.skData[i].result == 1 ? "阴性" : "阳性";
          }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
        shouqi(){
      if(this.span1==5){
           this.span1=1
        this.span2=23
      }else{
        this.span1=5
        this.span2=19
      }

    },
    // 打开执行
    handlePerformFlag() {
      if (this.performData2.length != 0) {
        this.performDate=this.newDate()
        this.performFlag = true;
      } else {
        this.$message({
          message: "请先选择要执行的医嘱或者请选择未执行的医嘱",
          type: "error",
        });
      }
    },
    // 执行单
    handleEditCarry(e) {
      // //  console.log(e);
      switch (e.key) {
        case 1:
          if (e.data.get_advice.skin_test == 1) {
            this.sktext = true;
            Object.keys(this.skAddObject).forEach((key) => {
              this.$set(this.skAddObject, key, "");
            });
            this.skAddObject.advice_id = e.data.advice_id;
            this.skAddObject.name = e.data.business_name;
            this.skAddObject.recipe_drug_id = e.data.business_id;
            this.skAddObject.specification = e.data.specification;
            this.getSkinTest(e.data.advice_id);
          } else {
            this.$message({
              message: "医嘱已皮试",
              type: "error",
            });
          }
          break;
        case 2:
          if (e.data.status == 2 ||e.data.status == 3) {
            //  console.log(e.data)
            this.zhixingmoney=e.data.get_advice.total
            this.xuanzeshij(e.data.id);
          } else {
            this.$message({
              message: "医嘱已执行",
              type: "error",
            });
          }

          break;
        case 3:
          this.$prompt("请输入退药原因", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
          })
            .then(({ value }) => {
              refundDrug({
                id: e.data.id,
                refund_drug_msg: value,
              }).then((res) => {
                if (res.code == 200) {
                  this.$message({
                    message: "提交成功",
                    type: "success",
                  });
                }
                this.adviceGetExecutionList();
              });
            })
            .catch(() => {
              this.$message({
                type: "info",
                message: "取消输入",
              });
            });
          break;
      }
    },
    tijiaochuyuan() {
      submitHospital({
        hospital_id: that.user.id,
        leave_time: that.apply_time.replace('T',' '),
      }).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.chuyuantilogdeposit = false;
          this.getHospitalMember();
        } else {
          //  this.$message(res.message);
        }
      });
    },
    xuanzeshij(id) {
      this.binglilogdeposit = true;
      this.execution_time=this.newDate()
      this.tid = id;
    },
    saveXml() {
      this.deductionAdvice(this.tid);
    },

    // 执行医嘱
    deductionAdvice(e) {
      deductionAdvice({
        ids: e,
        hospital_id: this.user.id,
        execution_time: this.execution_time.replace('T',' '),
      })
        .then((res) => {
          if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
          this.binglilogdeposit = false;
          this.adviceGetExecutionList();

        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 分床
    splitbed(arr) {
      var data_tt = arr[0];
      distributeBed(data_tt)
        .then((res) => {
          // //  console.log(res);
          if (res.code == 200) {
            this.$message({
              message: "操作成功",
              type: "success",
            });
            that.getHospitalMember();
            that.fooddialogdeposit = false;
          }
        })
        .catch((e) => {});
    },
    // /保存  分床
    handelMemberSave(arr) {
      this.$refs.splitbed.splitbed();
    },
    //床位
    getAllBedList() {
      var data_t = {
        icu_id: 0,
        is_lock: "2",
        bed: "",
        keyword: "",
        today: "",
      };
      getAllBedList(data_t)
        .then((res) => {
          let data = res.data.list;
          // //  console.log(data);
          that.ben_list = data;
        })
        .catch((e) => {});
    },
    getDictIndex() {
      getDictIndex({ group_id: "47,12,54,55,56" })
        .then((res) => {
          this.speedData = res.data;

          // //  console.log(res.data, "值");
          res.data[2].items.forEach((item) => {
            item.label = item.name;
            item.value = item.id;
          });
          res.data[3].items.forEach((item) => {
            item.label = item.name;
            item.value = item.id;
          });
          res.data[4].items.forEach((item) => {
            item.label = item.name;
            item.value = item.id;
          });
          this.hlTitle.forEach((item) => {
            if (item.prop == "cl_extraColor") {
              item.arr = res.data[2].items;
            } else if (item.prop == "gl_nurse") {
              item.arr = res.data[3].items;
            } else if (item.prop == "xuejiao") {
              item.arr = res.data[4].items;
            }
          });
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    handleTwClick(e) {
      if (e.length == 0) {
        return false;
      }
      e.forEach(item=>{
        item.hospital_id = this.user.id
      })
      console.error(e)
      updateTemperature({info: e })
        .then((res) => {
          // //  console.log(res);
          if (res.code == -1) {
            this.$message({
              message: "操作失败",
              type: "error",
            });
          } else {
            this.$message({
              message: "操作成功",
              type: "success",
            });
          }
          this.getTemperature()
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    handleClickNurse() {
      this.nurseOneVisible = false;
      // //  console.log(this.$refs.inputList1.tableData);
      let data = this.$refs.inputList1.tableData;
      if (data.length != 0) {
        data.forEach((item) => {
          item.cl_extra = {
            color: item.cl_extraColor,
            name: item.cl_extraName,
            tiji: item.cl_extraMl,
          };
          item.rl_extra = {
            name: item.rl_extraName,
            tiji: item.rl_extraMl,
          };
          item.xy_extra = {
            name: item.xy_extraBdg,
            tiji: item.xy_extraMz,
          };
        });
      }
      updateNurseSheet({ hospital_id: this.user.id, info: data })
        .then((res) => {
          if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 护理单列表
    getNurseSheet() {
      getNurseSheet({ hospital_id: this.user.id })
        .then((res) => {
          // //  console.log(res.data.lists, "护理单");
          if (res.data.lists.length == 0) {
            return false;
          }
          // //  console.log(this.speedData, "排气孔");
          res.data.lists.forEach((item) => {
            item.xy_extraBdg = item.xy_extra.bdg;
            item.xy_extraMz = item.xy_extra.mz;
            item.cl_extraName = item.cl_extra.name;
            item.cl_extraMl = item.cl_extra.tiji;
            item.cl_extraColor = item.cl_extra.color;
            item.rl_extraName = item.rl_extra.name;
            item.rl_extraMl = item.rl_extra.tiji;
          });
          this.hlData = res.data.lists;
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },

    // 体温单列表
    getTemperature() {
      getTemperature({ hospital_id: this.user.id })
        .then((res) => {
          // //  console.log(res.data.lists);
          if (res.data.lists.length == 0) {
            return false;
          }
          res.data.lists.forEach((item) => {
            Object.keys(item).forEach((key) => {
              if (item[key] === null) {
                item[key] = "";
              }
            });
          });
          this.twData = res.data.lists;
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 点击right
    searchRight() {
      this.schoolData = [];
      this.adviceData = [];
      this.performData = [];
      this.allData = [];
      this.deductionData = [];
      switch (this.activity) {
        case 1:
          this.limit = 100;
          this.adviceGetAdviceList();
          break;
        case 2:
          this.limit = 100;
          this.adviceGetAdviceList();
          break;
        case 3:
          this.limit = 100;
          this.adviceGetExecutionList();
          break;
        case 4:
          this.limit = 100;
          this.adviceGetAdviceList();
          break;
        case 5:
          this.getMemberMedicalList();
          break;
      }
    },
    // 重置
    resetRight() {
      this.time_type = "";
      this.radioValue = "";
      this.rightKeyValueSelect = "";
      this.rightPage = 1;
      switch (this.activity) {
        case 1:
          this.limit = 100;
          this.adviceGetAdviceList();
          break;
        case 2:
          this.limit = 100;
          this.adviceGetAdviceList();
          break;
        case 3:
          this.limit = 100;
          this.adviceGetExecutionList();
          break;
        case 4:
          this.limit = 100;
          this.adviceGetAdviceList();
          break;
        case 5:
          this.getMemberMedicalList();
          break;
      }
    },
    // 执行确定保存
    valuationEditFunction() {
      let data = this.$refs.EditFrom.handleFunction();

      data.forEach((item) => {
        item.source = 1;
      });
      createNurseAdvice({
        advice_id: this.advice_id,
        hospital_id: this.user.id,
        advice: data,
        deduction_time:this.deduction_time.replace('T',' ')
      })
        .then((res) => {
          // //  console.log(res);
          this.valuationEditFlag = false;
       if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 停止医嘱
    adviceNurseStopAdvice() {
        //  console.log(this.edataid)

      var art=this.edataid.join(",")
      adviceNurseStopAdvice({ ids:art, hospital_id: this.user.id,stop_time:this.stop_time})
        .then((res) => {

       if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
          // this.schoolData = [];
          // this.adviceData = [];
          this.tingzhilogdeposit=false
          this.adviceGetAdviceList();
          // this.getHospitalMember()
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 抄送
    getGenPharmacyDrug(e) {
      getGenPharmacyDrug({ advice_ids: e, hospital_id: this.user.id ,send_time:this.send_time})
        .then((res) => {
          if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
          // this.adviceData = [];
          // this.getHospitalMember()
          this.adviceGetAdviceList();
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
     cancelPharmacyDrug(e) {
      cancelPharmacyDrug({ advice_ids: e, hospital_id: this.user.id })
        .then((res) => {
          if (res.code==200) {
   this.$message({
              message: "操作成功",
              type: "success",
            });
             }
          // this.adviceData = [];
          // this.getHospitalMember()
          this.adviceGetAdviceList();
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 医嘱校对
    proofreaderAdvice(e, q) {
      proofreaderAdvice({ ids: q, hospital_id: this.user.id, action_type: e })
        .then((res) => {
           if (res.code==200) {
    this.$message({
            message: e == 1 ? "校对成功" : "回退成功",
            type: "success",
          });
             }

          // this.schoolData = [];
          // this.adviceData = [];
          // this.getHospitalMember()
          this.adviceGetAdviceList();
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 护理等级变更·
    nurseConfirm() {
      this.nurseVisible = false;
      if (this.nurseFrom.pid == "") {
        this.$message({
          message: "请选择更改的护理等级",
          type: "error",
        });
        return false;
      }
      // //  console.log(this.levelNature,"现在按了大大大")
      this.levelNature.forEach((item) => {
        if (this.nurseFrom.pid == item.id) {
          this.nurseFrom.name = item.name;
        }
      });
      setNurseLevel({ id: this.user.id, ...this.nurseFrom })
        .then((res) => {
           if (res.code==200) {
      this.$message({
            message: "变更护理等级成功",
            type: "success",
          });
          this.activity = 1;
             }

          this.getHospitalMember();
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },

    // 获取护理等级
    getNurseLevel() {
      getNurseLevel()
        .then((res) => {
          this.hlTitle.forEach((item) => {
            if (item.prop == "nurse_level") {
              item.arr = res.data;
            }
          });
          this.levelNature = res.data;
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 关闭弹窗e
    handleClose() {
      this.separateVisible = false;
      this.nurseOneVisible = false;
      this.changeVisible = false;
      this.paymentFlag = false;
      this.valuationEditFlag = false;
      this.animalFlag = false;
      this.hlData = [];
      this.twData = [];
    },
    handleClosePerform() {
      this.performFlag = false;
      this.ifexecution_time=false;
    },
    // 获取计价
    getNurseAdvice(e) {
      getNurseAdvice({ id: e })
        .then((res) => {
          if (res.data.lists.length != 0) {
            res.data.lists.map((item, key) => {
              item.key = key + 1;
              item.time_type = item.time_type == 1 ? "长期" : "临时";
              item.real_name = item.create_user.real_name;
              return item;
            });

            this.valuationData = res.data.lists;
          }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 左边表单选择
    handleCurrentChange(e) {
      this.activityInfo = e.key - 1;
      this.user = e;
      this.performData = [];
      this.maskData = [];
      // //  console.log(this.activity)
    },
    // 点击topMenuTab
    handleNurse(e) {
      // //  console.log(e);
      switch (e) {
        case 1:
          //  this.$message({
          //     message:"正在开发",
          //     type: 'error'
          //  });
        this.user_id=''
          this.dialogFormVisible1 = true;
            this.user_id=this.user.id
          break;
        case 2:
          this.getNurseSheet();
          this.nurseOneVisible = true;
          break;
        case 3:
          this.getTemperature();
          this.animalFlag = true;

          break;
        case 4:
          // this.$message({
          //   message:"正在开发",
          //   type: 'error'
          // });
          this.paymentFlag = true;
          this.$nextTick(()=>{
          this.url = `${iframeUrl}/#/info?type=1&templateId=17&id=${this.user.id}&userId=${this.user.member && this.user.member.id}&walletIncome=${this.user.walletIncome}&walletMoney=${this.user.walletMoney}&money=2000&userType=2&token=${localStorage.getItem("token")}`;
            setTimeout(function () {
              that.$nextTick(function () {
                let json = {
                  templateId: 17,
                  id:this.user.id,
                  userId:this.user.member && this.user.member.id,
                  type:1,
                  userType:2,
                  walletIncome: this.user.walletIncome,
                  walletMoney: this.user.walletMoney,
                  money: 2000,
                  token:localStorage.getItem("token")
                };
                this.$refs.iframeDemo.handleEmit(json);
              });
            }, 100);
          })
          break;
        case 5:
          // this.getTemperature();
          this.apply_time=this.newDate()
          this.chuyuantilogdeposit = true;

          break;
           case 6:
          // this.getTemperature();
        // //  console.log(this.$refs.mychild)

          this.dialogFormVisible12 = true;

          break;
          case 7:
            this.$confirm("是否撤销提交出院", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          }).then(() => {
            cancelSubmitHospital({
              hospital_id: this.user.id
            }).then(res => {
              if (res.code == 200) {
                this.$message({
                  message: "撤销成功",
                  type: "success"
                });
              } else {
                //  this.$message(res.message);
              }
            });
          });
          break;

      }
    },
    handleCurrentChangeSchool(e) {
      // this.doctorsData = e
      // //  console.log(e)
      this.valuationData = [];
      this.activityInfoRight = e.key - 1;
      if (e) {
        this.getNurseAdvice(e.id, 1);
      }
    },
    // 点击编辑按钮
    handleEdit(e) {
      if (e.key == 1) {
        this.proofreaderAdvice(e.key, e.data.id);
      }
    },
    // 获取用户选择框点击的按钮
    handleCommand(e) {
      switch (e.key) {
        case 1:
          // if (e.data.before_status == 1) {
            this.$confirm("你确定撤销校对么", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(() => {
              this.proofreaderAdvice(2, e.data.id);
            });
          // }
          // else {
          //   this.$message({
          //     message: "已执行医嘱不允许撤销",
          //     type: "error",
          //   });
          // }
          break;
        case 2:
          if (e.data.status == 5) {
            // this.$confirm("您确定停止医嘱么", "提示", {
            //   confirmButtonText: "确定",
            //   cancelButtonText: "取消",
            //   type: "warning",
            // }).then(() => {
            //   this.adviceNurseStopAdvice(e.data.id);
            // });
            this.edataid=[]
            this.edataid.push(e.data.id)
            this.tingzhilogdeposit=true
            this.stop_time=e.data.stop_time
            if(this.stop_time){
              this.stop_time=this.newDate()
            }
          } else {
            this.$message({
              message: "请先发起停止医嘱操作",
              type: "error",
            });
          }
          break;
        case 3:
          this.advice_id = e.data.id;

         this.deduction_time=this.newDate()
          this.valuationEditFlag = true;
          break;
        case 4:
          if (e.data.status != 2 && e.data.status != 6) {
            this.$confirm("你确定抄送当前医嘱么", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(() => {
              this.getGenPharmacyDrug(e.data.id);
            });
          } else {
            this.$message({
              message: "不能抄送的状态",
              type: "error",
            });
          }
          break;
                case 5:
          this.zhixupdata.id = e.data.id;
          this.zhixupdata.hospital_id=this.user.id
          this.addExecu=2
          this.ifexecution_time = true;
          this.zhixupdata.execution_time=this.newDate()
          break;
            case 6:
              // //  console.log(e.data)
          if (e.data.is_sendFlag!='未抄送') {

            this.$confirm("你确定撤销抄送当前医嘱么", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(() => {
              this.cancelPharmacyDrug(e.data.id);
            });
          } else {
            this.$message({
              message: "不能撤销未抄送的状态",
              type: "error",
            });
          }
          break;
      }
    },
    // 获取病区
    getAllIcu() {
      getAllIcu()
        .then((res) => {
          if (res.data.length != 0) {
            this.options = res.data;
          }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 获取数据字典
    dict_dataDictIndex() {
      dict_dataDictIndex({ group_id: "4" })
        .then((res) => {
          this.dataNature = res.data[0].items;
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 获取体温单数据字典
    dict_dataDictIndexTw() {
      dict_dataDictIndex({ group_id: "53" })
        .then((res) => {
          this.twTitle.forEach((item) => {
            if (item.prop == "t_time") {
              item.arr = res.data[0].items;
            }
          });
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    // 获取医嘱执行列表
    adviceGetExecutionList() {
      this.deductionData = [];
      adviceGetExecutionList({
        page: this.rightPage,
        limit: this.limit,
        status: this.advice_statusOne,
        hospital_id: this.user.id,
        keyword: this.rightKeyValue,
        time_type: this.rightKeyValueSelect,
        execution_time: this.execution_time2,
      })
        .then((res) => {
          // //  console.log(this.user.room_info);
          if (res.data.list.length == 0) {
            return false;
          }
          res.data.list.map((item, key) => {
            item.key = key + 1;
            item.number = item.number + item.unit;
            item.bedName = this.user.bedName;
            item.dose = item.dose + item.dose_unit;
            item.advice_statusName = item.status == 1 ? "已执行" : "未执行";
            item.time_type = item.get_advice.time_type == 1 ? "长期" : "临时";
            item.ipt_no = this.user.ipt_no;
            item.member_name = this.user.member.name;
            item.room_name = this.user.room_info[3];
            item.business_id = item.get_advice.business_id;
            item.advice_id = item.advice_id;
            item.business_name = item.get_advice.business_name;
            item.start_time = item.get_advice.start_time;
            item.specification = item.get_advice.specification;
            item.number = item.get_advice.number + item.get_advice.unit;
            item.dose = item.get_advice.dose + item.get_advice.dose_unit;
            if (item.get_advice.used_frqu) {
              item.used_frqu_name = item.get_advice.used_frqu.name;
            }
            item.usage = item.get_advice.usage;
            item.jioazhu = item.get_advice.jioazhu;
            //  item.deptName = item.get_advice.dept.name
            item.skin_test = item.get_advice.skin_test;
            item.skin_testName =
              item.skin_test == 1 ? "皮试" : item.skin_test == 2 ? "继用" : "";
            item.fee_category_name = item.get_advice.fee_category_name;
            item.end_time = item.get_advice.end_time;
            item.deptName = item.get_advice.department_name;
            item.advice_type =item.get_advice.type === 1
                ? "西药"
                : item.get_advice.type === 2
                ? "中药"
                : item.get_advice.type === 3
                ? "检验"
                : item.get_advice.type === 4
                ? "检查"
                : item.get_advice.type === 5
                ? "手术"
                : item.get_advice.type === 10
                ? "自带药"
                : item.get_advice.type === 11
                ? "量表"
                : item.get_advice.type === 7
                ? "术语"
                : item.get_advice.type === 8
                ? "项目"
                : item.get_advice.type === 9
                ? "出院带药"
                : "治疗";
            item.advice_doctor_name = item.get_advice.advice_doctor_name;
            item.execution_num = item.get_advice.execution_num;
            item.execution_time = item.get_advice.execution_time;
            item.refund_num = item.get_advice.refund_num;
            item.execution_user_name = item.get_advice.execution_user_name;
            var art=item.specification!=null?item.specification:''
            item.business_name2=item.business_name+''+art
             item.remark=item.get_advice.remark
            return item;
          });
          this.userCountOne = res.data.count;


          this.deductionData = res.data.list;
          // if(res.data.list.length>15){
                 setTimeout(function(){
                  that.height= that.height2
                  },300)
          // }else{
          //    that.height=0
          // }

              for (let j = 0; j <  this.deductionData.length; j++) {

        if ( this.deductionData[j].get_advice.is_group != null&& this.deductionData[j].get_advice.is_group!=0) {
         var  arr=[]
         for (let i = 0; i < this.deductionData.length; i++) {
            if(this.deductionData[i].get_advice.is_group==this.deductionData[j].get_advice.is_group){
              arr.push(i)
            }
          }
        for (let i = 0; i < arr.length; i++) {
          if(i==0){
                 this.deductionData[arr[i]].id2='┌'
          }else if (i==arr.length-1){
            this.deductionData[arr[arr.length-1]].id2='└'
          }else{
            this.deductionData[arr[i]].id2='|'
          }
        }
        }
      }
          console.error(this.deductionData,"执行信息")
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    radiochang() {
      this.getHospitalMember();
    },
    // 获取住院病人
    getHospitalMember() {
      this.tableData = [];
      getHospitalMember({
        page: this.page,
        limit: this.limit2,
        m_keyword: this.keyValue,
        icu_id: this.selectValue,
        status: this.rightRadio.toString(),
        advice_status: this.advice_status,
        is_new_advice: this.is_new_advice,
           order_by:this.order_by,
         source:'2'
      })
        .then((res) => {
          if (res.data.list.length == 0) {
            return false;
          }
          res.data.list.map((item, key) => {
            item.key = key + 1;
            if (typeof(this.levelNature.length) == "undefined"){}
            else{
              this.levelNature.forEach((list) => {
              // if (list.id == item.nurse_level) item.nurse_name = list.name;
              });
            }

            if (item.build) {
              item.buildName = item.build.name;
            }
            if (item.dept) {
              item.deptName = item.dept.name;
            }
            if (item.room_info) {
              item.buildName = item.room_info[1];
              item.bedName = item.room_info[3];
            }
            if (item.wallet) {
              item.walletMoney = item.wallet.wallet_money;
              item.walletIncome = item.wallet.wallet_income;
            }
            if (item.doctor) {
              item.doctorName = item.doctor.real_name;
            }
             if (item.nurse) {
              item.nurseName = item.nurse.real_name;
            }
            if (item.member) {
              item.memberName = item.member.name;
              item.memberGender = item.member.gender==1 ? "男" : "女";
              item.memberAge = item.age;

              this.dataNature.forEach((list) => {
                if (item.member.nature == list.id) {
                  item.memberNature = list.name;
                }
              });
            }
            if (item.disease) {
              item.diseaseName = item.disease.map((item) => {
                return item.disease_name;
              });
              item.diseaseName = item.diseaseName.join("&");
            }
            return item;
          });

          if (!this.entry) {
            //  this.user={}
            this.user = res.data.list[0];
               this.user.advice_djd=res.data.list[0].advice_djd
              this.user.advice_dtz=res.data.list[0].advice_dtz
                this.user.advice_dzx=res.data.list[0].advice_dzx

            this.entry = true;
            this.adviceGetAdviceList();
            //  console.log("user:::", this.user);
          }
            this.user = res.data.list[0];
          this.userCount = res.data.count;
          this.tableData = res.data.list;

          // this.user=this.tableData[0]
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    //获取医嘱列表

    adviceGetAdviceList() {
      if (this.activity == 1) {
        this.status = "2";
      } else if (this.activity == 2) {
        this.status = this.statusvalue2;
      } else if (this.activity == 4) {
        this.status = "3,4,5,6";
      }

      adviceGetAdviceList({
        page: this.rightPage,
        limit: this.limit,
        status: this.status,
        keyword: this.rightKeyValue,
        time_type: this.rightKeyValueSelect,
        hospital_id: this.user.id,
      })
        .then((res) => {
          if (res.data.list.length == 0) {
             this.schoolData=[]
             this.adviceData=[]
             this.allData = [];
             this.performData = [];
            return false;
          }
          res.data.list.map((item, key) => {
            item.key = key + 1;
            item.number = item.number + item.unit;
            item.dose = item.dose + item.dose_unit;
            item.reamrk= item.remark
            item.advice_type = item.type === 1? "西药" : item.type === 2
                ? "中药"
                : item.type === 3
                ? "检验"
                : item.type === 4
                ? "检查"
                : item.type === 5
                ? "手术"
                : item.type === 10
                ? "自带药"
                : item.type === 11
                ? "量表"
                : item.type === 7
                ? "术语"
                 : item.type === 8
                ? "项目"
                : item.type === 9
                ? "出院带药"
                : "治疗";
            item.ipt_no = this.user.ipt_no;
            item.bedName = this.user.bedName;
            item.skin_test =
              item.skin_test == 1 ? "皮试" : item.skin_test == 2 ? "继用" : "";
            item.is_sendFlag = item.is_send == 1 ?'已抄送':'未抄送'
            if (item.used_frqu) {
              item.usedName = item.used_frqu.name;

            }

            if (item.drip_speed) {
              this.speedData[0].items.forEach((list) => {
                if (item.drip_speed == list.id) {
                  item.drip_speedName = list.name;
                }
              });
            }
            if (item.jiaozhu) {
              this.speedData[1].items.forEach((list) => {
                if (item.jiaozhu == list.id) {
                  item.jiaozhuName = list.name;
                }
              });
            }


            item.deptName = item.dept.name;
            item.member_name = this.user.member.name;
            item.ipt_no = this.user.ipt_no;
             item.remark=item.remark
            item.time_type = item.time_type == 1 ? "长期" : "临时";
            item.statusName =
              item.status == 1
                ? "草稿"
                : item.status == 2
                ? "提交"
                : item.status == 3
                ? "校对"
                : item.status == 4
                ? "完成"
                : item.status == 5
                ? "待停止"
                : item.status == 6
                ? "已停止"
                : item.status == 7
                ? "废除"
                : "";

            return item;

          });
          this.userCountOne = res.data.count;
          //    if(res.data.list.length>15){
                 setTimeout(function(){
                    that.height= that.height2
                 },300)
          // }else{
            //that.height=0
          // }
          switch (this.activity) {
            case 1:
              this.schoolData = res.data.list;
              // //  console.log( this.schoolData)
                            for (let j = 0; j <  this.schoolData.length; j++) {

        if ( this.schoolData[j].is_group != null&& this.schoolData[j].is_group!=0) {
         var  arr=[]
         for (let i = 0; i < this.schoolData.length; i++) {
            if(this.schoolData[i].is_group==this.schoolData[j].is_group){
              arr.push(i)
            }
          }
        for (let i = 0; i < arr.length; i++) {
          if(i==0){
                 this.schoolData[arr[i]].id2='┌'
          }else if (i==arr.length-1){
            this.schoolData[arr[arr.length-1]].id2='└'
          }else{
            this.schoolData[arr[i]].id2='|'
          }
        }
        }
      }

              break;
            case 2:
              this.adviceData = res.data.list;
                         for (let j = 0; j <  this.adviceData.length; j++) {

        if ( this.adviceData[j].is_group != null&& this.adviceData[j].is_group!=0) {
         var  arr=[]
         for (let i = 0; i < this.adviceData.length; i++) {
            if(this.adviceData[i].is_group==this.adviceData[j].is_group){
              arr.push(i)
            }
          }
        for (let i = 0; i < arr.length; i++) {
          if(i==0){
                 this.adviceData[arr[i]].id2='┌'
          }else if (i==arr.length-1){
            this.adviceData[arr[arr.length-1]].id2='└'
          }else{
            this.adviceData[arr[i]].id2='|'
          }
        }
        }
      }
              console.error("进入",this.adviceData)
              break;
            case 3:
              this.performData = res.data.list;
              break;
            case 4:
              this.allData = res.data.list;

                         for (let j = 0; j <  this.allData.length; j++) {

        if ( this.allData[j].is_group != null&& this.allData[j].is_group!=0) {
         var  arr=[]
         for (let i = 0; i < this.allData.length; i++) {
            if(this.allData[i].is_group==this.allData[j].is_group){
              arr.push(i)
            }
          }
        for (let i = 0; i < arr.length; i++) {
          if(i==0){
                 this.allData[arr[i]].id2='┌'
          }else if (i==arr.length-1){
            this.allData[arr[arr.length-1]].id2='└'
          }else{
            this.allData[arr[i]].id2='|'
          }
        }
        }
      }
              break;
          }
        })
        .catch((e) => {
          this.$message({
            message: e.message,
            type: "error",
          });
        });
    },
    search() {
      this.page=1
      this.tableData = [];
      this.getHospitalMember();
    },
    //  查询按钮
    handleSizeChange(e) {
      this.limit = e;
      if (
        this.drugType == 5 ||
        this.drugType == 6 ||
        this.drugType == 9 ||
        this.drugType == 10 ||
        this.drugType == 13 ||
        this.drugType == 14 ||
        this.drugType == 16
      ) {
        this.tabData = [];
        this.tableTitle = [];
        this[this.InterfaceName[this.activeName - 1][this.drugType]]();
      }
    },
    // 分页Change
    handlePagination(e) {
      this.tabData = [];
      this.page = e;
      this.getHospitalMember();
    },
    // 分页Change
    rightHandlePagination(e) {
      this.rightPage = e;
      this.adviceData = []; //医嘱单
      this.deductionData = []; //待执行数据
      this.allData = []; //全部数据
      this.schoolData = [];
      if (this.activity == 3) {
        this.adviceGetExecutionList();
      } else {
        this.adviceGetAdviceList();
      }
    },
    //结算管理
    handdepositset() {
      this.tuifeiguanli=true
    },
    printAdvice(){
      let arr = this.maskData2.join(",");
        var data={
          hospital_id:this.user.id,
          ids:arr,
          type:this.rightKeyValueSelect
        }
        printAdvice(data).then(res=>{
         this.yizhudata=JSON.stringify(res.data)
          if(this.rightKeyValueSelect=='1'){
               const { href } = this.$router.resolve({
          path: "/workstation/yizhudan",
          query: { yizhudata:this.yizhudata  },
        });
        window.open(href, "_blank");

          }else{
               const { href } = this.$router.resolve({
          path: "/workstation/linyizhudan",
          query: { yizhudata:this.yizhudata  },
        });
        window.open(href, "_blank");

          }

          // setTimeout(this.yizhudataVisible1=true,500)

          // //  console.log(res)
        })

    },
    reload(){
       this.yizhudataVisible1=false
    },
    newDate(){
             let date = new Date()
        let yyyy = date.getFullYear()
        let MM = (date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : (date.getMonth() + 1)
        let dd = date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()
        let HH = date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()
        let mm = date.getMinutes() < 10 ? ("0" + date.getMinutes()) : date.getMinutes()
    var ss = date.getSeconds();
        let curDay = yyyy + '-' + MM + '-' + dd + 'T' + HH + ':' + mm+ ':' + ss;

      var start_time = curDay
      // //  console.log(start_time)
      return start_time
    }
  },
  components: {
     feeList,
    FromList,
    TopManu,
    ViewTitle,
    EditFrom,
    EDesc,
    EDescItem,
    inputList,
    Splitbed,
    iframeDemo,
    FromListButton,
    infocrad,
    infocrad2,

    PatientList,
    costRecord,
    yizhudan,
    linyizhudan,
    costtuifei
  },
};
</script>

<style lang="scss" scoped>
@import "./index.scss";
.img_box {
  width: 46px;
  height: 46px;
}
.span_title {
  font-weight: bold;
}
.img_kong_box {
  margin: auto;
  width: 90%;
  margin-top: 90px;
}
.cardhover {
  width: 280px;
  min-height: 280px;
}
.cardhover:hover {
  background: #aeecd1c2;
}
.img_kong {
  width: 100%;
  height: auto;
  margin: auto;
}
</style>
